FROM  python:3.10-slim

RUN groupadd -g 3000 aps && \
    useradd -u 3000 -g aps -m aps
# 设置工作目录
WORKDIR /app

# 时间同步
ENV TZ Asia/Shanghai
RUN ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime
RUN echo ${TZ} > /etc/timezone

# 将当前目录下的所有文件复制到工作目录
COPY app.py /app/app.py
COPY requirements.txt /app/requirements.txt

RUN pip install --upgrade pip

# 安装依赖
RUN pip install  -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/

RUN chown -R aps.aps /app
USER aps

# 暴露端口
EXPOSE 5000

# 运行命令
CMD ["python", "app.py"]
#CMD ["gunicorn", "-w", "4", "--bind", "0.0.0.0:5000", "app:app"]